﻿#ifndef WIDGET_H
#define WIDGET_H

#include <QOpenGLWidget>
#include <QOpenGLExtraFunctions>
#include <QOpenGLShaderProgram>
#include <QTimer>
#include <QOpenGLTexture>

class Widget : public QOpenGLWidget, protected QOpenGLExtraFunctions
{
public:
    Widget();
    ~Widget();
    void SetCounter(float v){ m_counter = v; }
    float GetCounter(){ return m_counter; }

public slots:
    void timeout();

protected:
    virtual void initializeGL();
    virtual void resizeGL(int w, int h);
    virtual void paintGL();
private:
    QTimer* m_Timer;
    float m_counter;
    //着色器程序
    QOpenGLShaderProgram* m_program;
    //位置
    GLuint m_posAttr;
    GLuint m_texCoordsAttr;


    GLuint m_VAO[1];
    GLuint m_VBO[1];

    QOpenGLTexture *m_texture;
};

#endif // WIDGET_H
